package com.hao.hospital.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;

public class GeneralMethod {
	/**
	 * 判断是否是手机号
	 * @param mobiles
	 * @return
	 */
	public  static boolean isMobileNO(String mobiles) {
		Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();
	}
	
	public static int isWork(String work) {
		int i = 0;
		if(StringUtils.isNotEmpty(work)){
			switch (work) {
			case "上班":
				i=1;
				break;
			case "出差":
				i=2;
				break;
			case "停职":
				i=3;
				break;
			case "离职":
				i=4;
				break;

			default:
				break;
			}
		}
		return i;
	}

	public static String isCondition(String s) {
		String c = "";
		if (StringUtils.isEmpty(s)) {
			c = "'%'";
			s = "%20";
		} else {
			c = "'%" + s + "%'";
		}
		return c;
	}

	public static String isState(int i) {
		String state = "";
		switch (i) {
		case 1:
			state = "上班";
			break;
		case 2:
			state = "出差";
			break;
		case 3:
			state = "停职";
			break;
		case 4:
			state = "离职";
			break;
		default:
			break;
		}
		return state;

	}

	public static String isUse(int i) {
		String use = "";
		switch (i) {
		case 1:
			use = "支付";
			break;
		case 2:
			use = "充值";
			break;
		default:
			break;
		}
		return use;
	}

	public static String isFlag(int i) {
		String flag = "";
		switch (i) {
		case 1:
			flag = "否";
			break;
		case 0:
			flag = "是";
			break;

		default:
			break;
		}
		return flag;
	}

	public static String isSex(int i) {
		String sex = "未知";
		switch (i) {
		case 1:
			sex = "男";
			break;
		case 2:
			sex = "女";
			break;
		case 3:
			sex = "未知";
			break;

		default:
			break;
		}
		return sex;
	}
}
